import React,{Component} from 'react';
import axios from 'axios'

export default class  Content extends Component{
    constructor(props){
		super(props);
		this.state={
			list:[]
		}
	}
	componentWillMount(){
		axios.post('http://localhost:3000/users/list',{})
		  .then((response)=> {			
			this.setState({
				list:response.data.docs,
				
			})
		  })
		  .catch(function (error) {
			console.log(error);
		  });
	  }
	render(){		
		const list=this.state.list		
        if(list.length>0){
		var  lis=[]
		for(let i=0;i<list.length;i++){
            lis.push(
				<li key={i}>{list[i].name}</li>
			)
		}
		console.log(lis)
		}
		return (
			<div>
			     <p>{this.props.match.params.level}</p>
				 <p>{JSON.stringify(this.props.location) }</p>
                  <ul>
					  显示{lis}
				  </ul>
			</div>
		)
	}
}
